//
//  StatusBottomView.swift
//  Weibo
//
//  Created by gdarkness on 16/3/28.
//  Copyright © 2016年 gdarkness. All rights reserved.
//

import UIKit
import SceneKit
class StatusBottomView: UIView {
   
    override init(frame: CGRect){
        super.init(frame: frame)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func prepareUI(){
        //backgroundColor = UIColor.random()
        //添加子控件
        addSubview(forwardButton)
        addSubview(commentButton)
        addSubview(likeButton)
        addSubview(separatorViewFirst)
        addSubview(separatorViewSecond)
        
        //添加约束
        //3个按钮平铺
        //转发按钮
        forwardButton.snp_makeConstraints { (make) -> Void in
            make.leading.top.bottom.equalTo(self)
        }
        
        //评论按钮
        commentButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(forwardButton.snp_trailing)
            make.top.bottom.equalTo(self)
            //狂赌
            make.width.equalTo(forwardButton)
        }
        
        //赞
        likeButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(commentButton.snp_trailing)
            make.top.trailing.bottom.equalTo(self)
            //宽度
            make.width.equalTo(forwardButton)
        }
        //分割线1
        separatorViewFirst.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(forwardButton.snp_trailing)
            make.centerY.equalTo(forwardButton)
        }
        //分割线2
        separatorViewSecond.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(commentButton.snp_trailing)
            make.centerY.equalTo(commentButton)
        }
    }
    
    //MARK: --lazyload
    //转发，使用默认参数
    private lazy var forwardButton: UIButton = UIButton(title: "转发", imagName: "timeline_icon_retweet")
    //评论
    private lazy var commentButton: UIButton = UIButton(title: "评论", imagName: "timeline_icon_comment")
    //赞
    private lazy var likeButton: UIButton = UIButton(title: "赞", imagName: "timeline_icon_unlike")
    
    //分割线1
    private lazy var separatorViewFirst: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
    //分割线2
    private lazy var separatorViewSecond: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
}
